import { createEvent, createStore } from 'effector';

import { resetStore } from 'store';

import { Port } from './types';

// Event
export const setHubInfo = createEvent<Port | null>();

// Store
export const $hubInfo = createStore<Port | null>(null)
  .on(setHubInfo, (_, hubInfo) => hubInfo || null)
  .reset(resetStore);
